/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.util.Iterator;
import stamboom.Gezin;
import stamboom.Persoon;

/**
 *
 * @author Cabez
 */
public class BestaandPersoonFrame extends javax.swing.JFrame {

    Persoon pers;
    /**
     * Creates new form BestaandPersoonFrame
     */

    public BestaandPersoonFrame(Persoon p) {
        initComponents();
        this.pers = p;
        
        this.persoonPanel1.setPersoonsnummer(p.getNr());
        this.persoonPanel1.setAchternaam(p.getAchternaam());
        this.persoonPanel1.setVoornamen(p.getVoornamen());
        this.persoonPanel1.setTussenvoegsel(p.getTussenvoegsel());
        this.persoonPanel1.setGeslacht(p.getGeslacht());
        this.persoonPanel1.setGebDat(p.getGebdat());
        jtaGeneraties.setText(p.stamboomGegevensAlsString());
        Iterator it = p.getGezinnen();
        if(it != null){
            jcbEigenGezinnen.setEnabled(false);
            while(it.hasNext()){
                jcbEigenGezinnen.addItem(it.next().toString());
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        persoonPanel1 = new gui.PersoonPanel();
        jLabel1 = new javax.swing.JLabel();
        jcbEigenGezinnen = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtaGeneraties = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("Eigen gezinnen");

        jtaGeneraties.setColumns(20);
        jtaGeneraties.setRows(5);
        jScrollPane1.setViewportView(jtaGeneraties);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(jLabel1)
                .addGap(47, 47, 47)
                .addComponent(jcbEigenGezinnen, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(jScrollPane1)
            .addComponent(persoonPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(persoonPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jcbEigenGezinnen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JComboBox jcbEigenGezinnen;
    private javax.swing.JTextArea jtaGeneraties;
    private gui.PersoonPanel persoonPanel1;
    // End of variables declaration//GEN-END:variables
}
